// mysql.mjs

import mysql from 'mysql2/promise';

// Function to create a MySQL connection pool
async function createConnectionPool() {
    try {
        return await mysql.createPool({
            host: '127.0.0.1',
            user: 'newWorld',
            password: 'newWorld',
            database: 'newWorld',
            waitForConnections: true,
            connectionLimit: 10,
            queueLimit: 0
        });
    } catch (error) {
        console.error('Error creating MySQL connection pool:', error);
        throw error;
    }
}

// Export the createConnectionPool function
export { createConnectionPool };
